package com.chengliang.bbs.controller;

import com.chengliang.bbs.entry.JSONResult;
import com.chengliang.bbs.service.ReplyService;
import com.chengliang.bbs.util.UserUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 回复
 */
@RestController
@RequestMapping("/reply")
public class ReplyController {

    @Autowired
    private ReplyService replyService;

    @PostMapping("/delete")
    public JSONResult delete(Integer id){
        if(UserUtils.isNotAdmin()){
            return JSONResult.error("无权限进行操作");
        }
        return JSONResult.is(replyService.dropReplyById(id),"删除回复");
    }

}
